<template>
    <div class="box">
     <h3>组合式api的组件语法定义</h3>
        <MyChild :msg="msg" @updata:info="updataInfo" ref="childComp"></MyChild>
        <p>
        子组件变量{{ cinfo }}
        <input type="button" value="访问子组件方法" @click="exChildFun()">
        </p>
    </div>
</template>
<script setup>
import {ref} from 'vue'
import MyChild from './components/MyChild.vue'

let msg=ref('父组件变量')
let cinfo=ref('')

let updataInfo=function(nv){
    cinfo.value=nv
}
let childComp=ref()
let exChildFun=function(){
    console.log(childComp.value);
    console.log(childComp.value.printTest);
    childComp.value.printTest()
    
}
</script>